/**
 * 	Syllabus.java
 *
 *  This file is part of the PDFGen Syllabus Formatter Project.
 *  Copyright (C) 2011  Gian Fontanilla
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.dlsu.pdfgen.struct;

import java.util.ArrayList;

import org.dlsu.pdfgen.Formatter;

/**
 * The data structure representing a <CODE>Syllabus</CODE>. The
 * <CODE>Formatter</CODE> class uses an object of this class to generate a PDF
 * file.
 *
 * @author pckid
 * @version 0.04a
 * @see Formatter
 */
public class Syllabus {

	/** The course code. */
	private String courseCode;

	/** The course description. */
	private String courseDesc;

	/** The course type, i.e., if "Major Lecture" or "Lab". */
	private String courseType;

	/** The course title, i.e., for DASALGO, "Data Structures and Algorithms". */
	private String courseTitle;

	/** */
	private String faculty;

	/** */
	private String term;

	/** */
	private String time;

	/** */
	private String room;

	/** */
	private ArrayList<Topic> topics;

	/** */
	private ArrayList<String> requirements;

	/** */
	private String requirementListType;

	/** */
	private ArrayList<Assessment> assessments;

	/** */
	private ArrayList<String> materials;

	/** Indicates whether the list should be plain, bulleted, or numbered. */
	private String materialListType;

	/** */
	private ArrayList<String> references;

	/** Indicates whether the list should be plain, bulleted, or numbered. */
	private String referenceListType;

	/** */
	private ArrayList<String> objectives;

	/** */
	private String objectivePreamble;

	/** */
	private ArrayList<String> preRequisiteCourses;

	/** */
	private ArrayList<String> postRequisiteCourses;

	/** */
	private ArrayList<String> coRequisiteCourses;

	/**
	 * Constructor initializing all attributes so as to avoid them being
	 * <CODE>null</CODE>.
	 */
	public Syllabus() {

		this.courseCode = "";
		this.courseDesc = "";
		this.courseType = "";
		this.courseTitle = "";
		this.faculty = "";
		this.term = "";
		this.time = "";
		this.room = "";
		this.topics = new ArrayList<Topic>();
		this.requirements = new ArrayList<String>();
		this.assessments = new ArrayList<Assessment>();
		this.materials = new ArrayList<String>();
		this.references = new ArrayList<String>();
		this.preRequisiteCourses = new ArrayList<String>();
		this.postRequisiteCourses = new ArrayList<String>();
		this.objectives = new ArrayList<String>();
	}

	/**
	 * @return
	 */
	public String getCourseCode() {
		return courseCode;
	}

	/**
	 * @param courseCode
	 */
	public void setCourseCode(String courseCode) {
		this.courseCode = courseCode;
	}

	/**
	 * @return
	 */
	public String getCourseDesc() {
		return courseDesc;
	}

	/**
	 * @param courseDesc
	 */
	public void setCourseDesc(String courseDesc) {
		this.courseDesc = courseDesc;
	}

	/**
	 * @return
	 */
	public ArrayList<String> getPreRequisiteCourses() {
		return preRequisiteCourses;
	}

	/**
	 * @param preRequisiteCourses
	 */
	public void setPreRequisiteCourses(ArrayList<String> preRequisiteCourses) {
		this.preRequisiteCourses = preRequisiteCourses;
	}

	/**
	 * @return
	 */
	public ArrayList<String> getPostRequisiteCourses() {
		return postRequisiteCourses;
	}

	/**
	 * @param postRequisiteCourses
	 */
	public void setPostRequisiteCourses(ArrayList<String> postRequisiteCourses) {
		this.postRequisiteCourses = postRequisiteCourses;
	}

	/**
	 * @return
	 */
	public ArrayList<String> getCoRequisiteCourses() {
		return coRequisiteCourses;
	}

	/**
	 * @param coRequisiteCourses
	 */
	public void setCoRequisiteCourses(ArrayList<String> coRequisiteCourses) {
		this.coRequisiteCourses = coRequisiteCourses;
	}

	/**
	 * @return
	 */
	public String getCourseType() {
		return courseType;
	}

	/**
	 * @param courseType
	 */
	public void setCourseType(String courseType) {
		this.courseType = courseType;
	}

	/**
	 * @return
	 */
	public String getFaculty() {
		return faculty;
	}

	/**
	 * @param faculty
	 */
	public void setFaculty(String faculty) {
		this.faculty = faculty;
	}

	/**
	 * @return
	 */
	public String getTerm() {
		return term;
	}

	/**
	 * @param term
	 */
	public void setTerm(String term) {
		this.term = term;
	}

	/**
	 * @return
	 */
	public String getTime() {
		return time;
	}

	/**
	 * @param time
	 */
	public void setTime(String time) {
		this.time = time;
	}

	/**
	 * @return
	 */
	public String getRoom() {
		return room;
	}

	/**
	 * @param room
	 */
	public void setRoom(String room) {
		this.room = room;
	}

	/**
	 * @return
	 */
	public ArrayList<String> getObjectives() {
		return objectives;
	}

	/**
	 * @param objectives
	 */
	public void setObjectives(ArrayList<String> objectives) {
		this.objectives = objectives;
	}

	/**
	 * @return
	 */
	public ArrayList<Topic> getTopics() {
		return topics;
	}

	/**
	 * @param topics
	 */
	public void setTopics(ArrayList<Topic> topics) {
		this.topics = topics;
	}

	/**
	 * @return
	 */
	public ArrayList<String> getRequirements() {
		return requirements;
	}

	/**
	 * @param requirements
	 */
	public void setRequirements(ArrayList<String> requirements) {
		this.requirements = requirements;
	}

	/**
	 * @return
	 */
	public ArrayList<Assessment> getAssessments() {
		return assessments;
	}

	/**
	 * @param assessment
	 */
	public void setAssessments(ArrayList<Assessment> assessments) {
		this.assessments = assessments;
	}

	/**
	 * @return
	 */
	public ArrayList<String> getMaterials() {
		return materials;
	}

	/**
	 * @param materials
	 */
	public void setMaterials(ArrayList<String> materials) {
		this.materials = materials;
	}

	/**
	 * @return
	 */
	public ArrayList<String> getReferences() {
		return references;
	}

	/**
	 * @param references
	 */
	public void setReferences(ArrayList<String> references) {
		this.references = references;
	}

	/**
	 * @return
	 */
	public String getCourseTitle() {
		return courseTitle;
	}

	/**
	 * @param courseTitle
	 */
	public void setCourseTitle(String courseTitle) {
		this.courseTitle = courseTitle;
	}

	/**
	 * @return
	 */
	public String getObjectivePreamble() {
		return objectivePreamble;
	}

	/**
	 * @param objectivePreamble
	 */
	public void setObjectivePreamble(String objectivePreamble) {
		this.objectivePreamble = objectivePreamble;
	}

	/**
	 * @return
	 */
	public String getReferenceListType() {
		return referenceListType;
	}

	/**
	 * @param referenceListType
	 */
	public void setReferenceListType(String referenceListType) {
		this.referenceListType = referenceListType;
	}

	/**
	 * @return
	 */
	public String getRequirementListType() {
		return requirementListType;
	}

	/**
	 * @param requirementListType
	 */
	public void setRequirementListType(String requirementListType) {
		this.requirementListType = requirementListType;
	}

	/**
	 * @return
	 */
	public String getMaterialListType() {
		return materialListType;
	}

	/**
	 * @param materialListType
	 */
	public void setMaterialListType(String materialListType) {
		this.materialListType = materialListType;
	}

	/**
	 * Creates and returns an <CODE>Assessment</CODE> object.
	 *
	 * @param item
	 *            The assessment item's name
	 * @param value
	 *            The item's value
	 * @return
	 */
	public Assessment createAssessment(String item, String value) {
		return new Assessment(item, value);
	}

	/**
	 * Gets an assessment item's name.
	 *
	 * @param assessment
	 *            The assessment
	 * @return The assessment item's name
	 */
	public static String getAssessmentItem(Object assessment) {

		if (assessment instanceof Assessment)
			return ((Assessment) assessment).item;
		return null;
	}

	/**
	 * Gets an assessment item's value.
	 *
	 * @param assessment
	 *            The assessment
	 * @return The assessment item's name
	 */
	public static String getAssessmentValue(Object assessment) {

		if (assessment instanceof Assessment)
			return ((Assessment) assessment).value;
		return null;
	}

	/**
	 * Creates and returns a <CODE>Topic</CODE> object.
	 *
	 * @param name
	 *            The topic's name
	 * @param week
	 *            When the topic will be discussed
	 * @param hour
	 *            The number of hours to be spent on this topic
	 * @return
	 */
	public Topic createTopic(String name, String week, String hour) {
		return new Topic(name, week, hour);
	}

	/**
	 * Gets a topic's name.
	 *
	 * @param topic
	 *            The topic
	 * @return The topic's name
	 */
	public static String getTopicName(Object topic) {

		if (topic instanceof Topic)
			return ((Topic) topic).name;
		return null;
	}

	/**
	 * Gets a topic's week.
	 *
	 * @param topic
	 *            The topic
	 * @return The topic's week
	 */
	public static String getTopicWeek(Object topic) {

		if (topic instanceof Topic)
			return ((Topic) topic).week;
		return null;
	}

	/**
	 * Gets a topic's hour.
	 *
	 * @param topic
	 *            The topic
	 * @return The topic's hour
	 */
	public static String getTopicHour(Object topic) {

		if (topic instanceof Topic)
			return ((Topic) topic).hour;
		return null;
	}

	/**
	 * Data type for assessment.
	 *
	 * @author Gian Fontanilla
	 */
	private class Assessment {

		/** */
		private String item;

		/** */
		private String value;

		/**
		 * Constructor accepting item and value.
		 *
		 * @param item
		 *            The assessment item's name
		 * @param value
		 *            The item's value (in percent)
		 */
		private Assessment(String item, String value) {

			this.item = item;
			this.value = value;
		}
	}

	/**
	 * Data type for topic.
	 *
	 * @author Gian Fontanilla
	 */
	private class Topic {

		/** */
		private String name;

		/** */
		private String week;

		/** */
		private String hour;

		/**
		 * Constructor accepting name, week and hour.
		 *
		 * @param name
		 *            The topic's name
		 * @param week
		 *            When the topic will be discussed
		 * @param hour
		 *            The number of hours to be spent on this topic
		 */
		private Topic(String name, String week, String hour) {

			this.name = name;
			this.week = week;
			this.hour = hour;
		}
	}
}
